const path = require("path");
const common = require('./webpack.common');
const { merge } = require('webpack-merge');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');//每次打包之前会清除掉之前的包
const CopyWebpackPlugin = require("copy-webpack-plugin");//拷贝配置文件到打包文件夹下

module.exports = merge(common, {
    mode: 'production',
    devtool: false,
    plugins: [
        new CleanWebpackPlugin(),
        new CopyWebpackPlugin(
            {
                patterns: [{
                    from: path.resolve(__dirname, 'public'),
                    to: path.resolve(__dirname, 'dist')

                }]

            }
        )
    ],
})